﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Abigail.Model
{
    public class StockLocation
    {
        public string StockLocationCode
        {
            get
            {
                string codeString;
                if (Area != null)
                    codeString = String.Format("{0}-{1}-{2}-{3}", Area.Area, Shelf, Level, Section);
                else
                    codeString = String.Format("00-{0}-{1}-{2}", Shelf, Level, Section);
                return codeString;
            }
        }

        private int id;
        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        private Model.StockLocationArea area;
        internal Model.StockLocationArea Area
        {
            get { return area; }
            set { area = value; }
        }

        private string areaCode;
        public string AreaCode
        {
            get
            {
                if (area == null)
                    return "XX";
                else
                    return area.Area; }
            set { areaCode = value; }
        }

        private string shelf;
        public string Shelf
        {
            get { return shelf; }
            set { shelf = value; }
        }

        private string level;
        public string Level
        {
            get { return level; }
            set { level = value; }
        }

        private string section;
        public string Section
        {
            get { return section; }
            set { section = value; }
        }

        public StockLocation()
        {
            this.id = 0;
            this.area = null;
            this.shelf = "";
            this.level = "";
            this.section = "";
        }

        public StockLocation(int id, StockLocationArea area, string shelf, string level, string section)
        {
            this.id = id;
            this.area = area;
            this.shelf = shelf;
            this.level = level;
            this.section = section;
        }
    }
}
